package com.wuseguang.springcloud.dao.repository;

import com.wuseguang.springcloud.entity.RoleDataPermissions;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface RoleDataPermissionsRepository extends JpaRepository<RoleDataPermissions,Integer> {

    /**
     * 根据角色id和学校id查询这个角色是否有数据权限
     * @param roleId
     * @param schoolId
     * @return
     */
    @Query(value = "select * from role_data_permissions  where  role_id = ?1 and school_id = ?2",nativeQuery = true)
    RoleDataPermissions findRoleIdAndSchoolId(Integer roleId, String schoolId);

}
